package com.oepm.biz.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.oepm.vo.DataVo;
import com.oepm.biz.TitleVerifyBiz;
import com.oepm.dao.entity.*;
import com.oepm.dao.mapper.TitleVerifyMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TitleVerifyBizImpl implements TitleVerifyBiz {
    @Resource
    TitleVerifyMapper titleVerify;

    @Override
    public String queryLevel(int id) {
        return titleVerify.queryLevel(id);
    }

    @Override
    public DataVo labTitle(String academy, QueryInfo queryInfo) {
        PageHelper.startPage(queryInfo.getPagenum(),queryInfo.getPagesize());
        List<TeacherDemoApplicationPo> teacherDemoApplicationPos = titleVerify.labTitle(academy);
        PageInfo<TeacherDemoApplicationPo> pi = new PageInfo<>(teacherDemoApplicationPos);
        return new DataVo(pi.getTotal(),pi.getList());
    }

    @Override
    public DataVo academyTitle(String academy, QueryInfo queryInfo) {
        PageHelper.startPage(queryInfo.getPagenum(),queryInfo.getPagesize());
        List<TeacherDemoApplicationPo> teacherDemoApplicationPos = titleVerify.academyTitle(academy);
        PageInfo<TeacherDemoApplicationPo> pi = new PageInfo<>(teacherDemoApplicationPos);
        return new DataVo(pi.getTotal(),pi.getList());
    }

    @Override
    public DataVo adminTitle(QueryInfo queryInfo) {
        PageHelper.startPage(queryInfo.getPagenum(),queryInfo.getPagesize());
        List<TeacherDemoApplicationPo> teacherDemoApplicationPos = titleVerify.adminTitle();
        PageInfo<TeacherDemoApplicationPo> pi = new PageInfo<>(teacherDemoApplicationPos);
        return new DataVo(pi.getTotal(),pi.getList());
    }

    @Override
    public int verify(TitleVerifyInfoVo info) {
        return titleVerify.verify(info);
    }

    @Override
    public TeacherDemoApplicationPo selectById(String id) {
        return titleVerify.selectById(id);
    }

    @Override
    public int uploadEstablishTitle(EstabProjectPo ePP) {
        return titleVerify.uploadEstablishTitle(ePP);
    }

    @Override
    public int uploadScore(String pid) {
        return titleVerify.uploadScore(pid);
    }

    @Override
    public int uploadResult(String pid) {
        return titleVerify.uploadResult(pid);
    }

    @Override
    public int uploadApp(String pid) {
        return titleVerify.uploadApp(pid);
    }
}
